﻿-- =============================================
-- Author:		<Author,,Name>
-- Create date: <Create Date, ,>
-- Description:	<Description, ,>
-- =============================================
CREATE FUNCTION [dbo].[f_StringToUI]
(
	-- Add the parameters for the function here
	@str varchar(100)
)
RETURNS uniqueidentifier
AS
BEGIN
	set @str = upper(@str)

	declare @ui uniqueidentifier
	
	set @ui = cast(
		substring(@str, 1,8) + '-' +
		substring(@str, 9,4) + '-' +
		substring(@str, 13,4) + '-' +
		substring(@str, 17,4) + '-' +
		substring(@str, 21,12)
		as uniqueidentifier
		)
	
	RETURN @ui

END
